import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from "@/layout"

Vue.use(VueRouter)

/**
 * hidden:显示或隐藏菜单，默认为false
 * title:菜单标题
 * icon：菜单图标
 */


export const pcMenusRoute =
{
  path: '/pc',
  component: Layout,
  redirect: '/pc/dashboard',
  children: [
    {
      path: 'dashboard',
      component: () => import('@/views/pc/dashboard'),
      name: 'Dashboard',
      meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
    }, {
      path: 'support',
      component: () => import('@/views/pc/support'),
      name: 'Support',
      meta: { title: 'support', icon: 'dashboard' }
    }, {
      path: 'mock',
      component: () => import('@/views/pc/mockData'),
      name: 'MockData',
      meta: { title: 'mock', icon: 'dashboard' }
    }, {
      path: 'http-api-log',
      component: () => import('@/views/pc/httpApiLog'),
      name: 'HttpApiLog',
      meta: { title: 'httpApiLog', icon: 'dashboard' }
    },
    {
      path: 'demo',
      component: () => import('@/views/pc/demo'),
      name: 'Demo',
      meta: { title: 'demo', icon: 'dashboard' }
    },
    {
      path: 'test02',
      component: () => import('@/views/pc/test02'),
      name: 'Test02',
      meta: { title: 'test02', icon: 'dashboard' }
    },
    {
      path: 'charts',
      component: () => import('@/views/pc/test02'),
      name: 'charts',
      meta: { title: 'charts', icon: 'dashboard' },
      children: [
        {
          path: 'chart1',
          component: () => import('@/views/pc/test02'),
          name: 'chart1',
          meta: { title: 'chart1', icon: 'dashboard' },
        },
        {
          path: 'chart2',
          component: () => import('@/views/pc/test02'),
          name: 'chart2',
          meta: { title: 'chart2', icon: 'dashboard' },
          children: [
            {
              path: 'chart21',
              component: () => import('@/views/pc/test02'),
              name: 'chart21',
              meta: { title: 'chart21', icon: 'dashboard' },
            },
            {
              path: 'chart22',
              component: () => import('@/views/pc/test02'),
              name: 'chart22',
              meta: { title: 'chart22', icon: 'dashboard' },
            }
          ]
        }
      ]
    }
  ]
}
export const appMenusRoute =
{
  path: '/app',
  component: () => import('@/views/app/index'),
  name: 'AppIndex'
}

export const adminMenusRoute={
  path: '/admin/mockData',
  component: () => import('@/views/admin/mockData'),
  name: 'MockData'
}
const routes = [
  {
    path: '/',
    redirect: "/login",
  },
  {
    path: '/index',
    component: () => import('@/views/index'),
    name: 'Index',
    children:[pcMenusRoute,appMenusRoute]
  },
  {
    path: '/login',
    component: () => import('@/views/login'),
    name: 'Login'
  },adminMenusRoute
]

const router = new VueRouter({
  routes
})

export default router
